<?php

namespace App\Http\Requests;


use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
//自定义请求类，里面有验证规则和登录状态
class PackageRequest extends FormRequest
{
   
    public function authorize()
    {
        return true;
    }

   
    public function rules()
    {
        //请求给请求定义validate验证规格, Rule::unique('packages')->ignore(request()->package) 自动传入id，纵向验证时，自己改写忽略
        return [
            //
            'title' => ['required', 'min:3', 'max:20', Rule::unique('packages')->ignore(request()->package)]
        ];
    }
   
}
